package com.example.demo.warn.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

/**
 * 预警定时任务线程池
 *
 * @author yuanz
 * @date 2024/06/06
 */
@Configuration
public class WarnAsyncConfig {
    @Bean
    public ThreadPoolTaskScheduler taskScheduler() {
        ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
        // 设置线程池大小
        scheduler.setPoolSize(10);
        scheduler.setThreadNamePrefix("warn-scheduler-task-");
        return scheduler;
    }
}
